//
//  SettlementWayViewController.m
//  SameWorld(merchant)
//
//  Created by 李小朋 on 2017/4/2.
//  Copyright © 2017年 杨旭. All rights reserved.
//

#import "SettlementWayViewController.h"
#import "StoresManageCell.h"
@interface SettlementWayViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic ,strong) UserInfo *userInfo;
@property (nonatomic ,strong) UITableView *tableView;
@property (nonatomic ,strong) NSArray *titles;
@property (nonatomic ,strong) NSArray *images;
@property (nonatomic ,strong) NSArray *dataSource;
@end
@implementation SettlementWayViewController

- (NSArray *)titles {
    if (!_titles) {
        _titles = @[@"收款方：",@"账    号：",@"收款人："];
    }
    return _titles;
}

- (NSArray *)images {

    if (!_images) {
        _images = @[@"shoukuanfangshi",@"shoukuanzhanghao",@"shoukuanren"];
    }
    return _images;
}

- (NSArray *)dataSource {
    if (!_dataSource) {
        _userInfo = [UserInfo sharedUserInfo];
        _dataSource = @[_userInfo.account_unmber,_userInfo.receivables_type,_userInfo.payee];
    }
    return _dataSource;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"结算方式";
    [self createTableView];
}

- (void)createTableView {

    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, size_width, size_height - 64) style:(UITableViewStylePlain)];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.scrollEnabled = NO;
    self.tableView.backgroundColor = [UIColor colorWithHexString:@"#f2f2f2"];
    [self.view addSubview:self.tableView];
    
    // 注册cell
    [self.tableView registerNib:[UINib nibWithNibName:@"StoresManageCell" bundle:nil] forCellReuseIdentifier:@"StoresManageCell"];
    
}

#pragma mark - UITableView的代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.titles.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    StoresManageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"StoresManageCell" forIndexPath:indexPath];
    cell.title.text = self.titles[indexPath.row];
    cell.image.image = [UIImage imageNamed:self.images[indexPath.row]];
    cell.contentLabel.text = self.dataSource[indexPath.row];
    return cell;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 8;
}


@end
